-module(room_ctr).
-behaviour(gen_server).
-export([start_link/0, stop/0, init/1, terminate/2, code_change/3, handle_cast/2, handle_info/2, handle_call/3 ]).
-include("common.hrl").

-record(state, {id = 0}).
start_link() ->
    gen_server:start_link({global, room_ctr}, ?MODULE, [], []).
stop() ->
    gen_server:cast({global, room_ctr}, stop).

init([]) ->
	?debug("room_ctr inited"),
    {ok, #state{}}.

terminate(_Reason, #state{}) ->
    ok.

code_change(_OldVsn, State, _Extra) ->    
    {ok, State}.

handle_call(_Request, _From, State) ->    
    {reply, ok, State}.

handle_info(_Request, State) ->
    {noreply, State}.

%% handle_cast({req_create_scene,{Key,UsrInfoList,NeedUsrInfo,Scene,SceneData}},State) ->
handle_cast({req_create_room,{Sid,Acc,Req,RoomID,Psw,Seq}},State) ->
	?debug("req_create_room,{Sid,Acc,Req,RoomID,Psw,Seq} = ~p",[{Sid,Acc,Req,RoomID,Psw,Seq}]),
	room_sup:add(Sid,Acc,Req,RoomID,Psw,Seq),
	{noreply, State};

handle_cast(stop, State) ->
    {stop, normal, State};

handle_cast(_Request, State) ->
	?log_error("unmatch _Request=~p",[_Request]),
    {noreply, State}.


